<template>
	<view>
		<!-- #ifdef MP-WEIXIN -->
		<x-title :ishowZw='true' :title_bg='true' titleText=''>
			<view class="input  flex align-center" slot="input">
				<view class="input_img aj-center ml-20" @click="inputsearch">
					<image src="../static/doct/search.png" mode=""></image>
				</view>
				<input type="text" v-model="inputtext" class="ml-20 fs-26 fw-400 c-99" @focus="leftimg=false"
					placeholder="输入关键字搜索" value="" @confirm="inputsearch" />
				<view class="input_img aj-center" @click="clear" v-show="inputtext.length>0">
					<image src="../static/doct/x.png" mode=""></image>
				</view>
			</view>
		</x-title>
		<!-- #endif -->
	<view class="" v-if="zanwushuj" style="width: 100%;text-align: center;">
			暂无更多
		</view> 
		<view class="mt-43 mb-24 mx-35-30" v-if="article">
			<x-banner-title lefttitle="商城购买" v-if="goods.length!=0" />
		</view>

		<view class="just-between mx-28 ">
			<view class="bshow6 bor-r20 px-20" style="width: 338rpx;height: 475rpx;box-sizing: border-box;"
				v-for="(item,index) in goods" :key="item.id">
				<view class="" style="width: 260rpx;height: 260rpx;padding-left: 34rpx;">
					<image :src="item.image" mode=""></image>
				</view>
				<view class="mt-20 f-26 f-bold c-11" style="height: 73rpx;">
					{{item.title}}
				</view>
				<view class="mt-10 c-77 f-22 fw-400">
					月售{{item.sales}}
				</view>
				<view class="mt-24 just-between">
					<view class="c-F35C0F f-bold f-34">
						￥{{item.price}}
					</view>
					<view class="" style="width: 32rpx;height: 32rpx;">
						<image src="../static/doct/jia.png" mode=""></image>
					</view>
				</view>
			</view>


		</view>
		<view class="mt-43 mb-24 mx-35-30" @click="doctAll" v-if="doctor">
			<x-banner-title lefttitle="医生推荐" righttitlebool="true" v-if="doctor.length!=0" />
		</view>
		<!-- :name="item.doctor_name"
		:img="item.image"
		:Departments="item.type_name"
		:site="item.address" -->
		<x-doctor-once v-for="(item,index) in doctor" :key="item.id" :item="item" @click.native="doctintro(item.id)" />
		<view class="  mb-24 mx-35-30" v-if="article">
			<x-banner-title lefttitle="相关科普" v-if="article.length!=0" />
		</view>

		<view class="flex border-b-EEEEEE mb-30" v-for="(item,index) in article" :key="item.id">
			<view class="px-28 flex mb-30" style="">
				<view class="mr-24" style="width: 174rpx;height: 144rpx;">
					<image :src="item.image" mode=""></image>
				</view>
				<view class="">
					<view class="c-11 f-400 f-28" style="height: 80rpx;">
						{{item.title}}
					</view>
					<view class="mt-31 just-between f-400 f-24 c-AAAAAA" s>
						<view class="flex" style="margin-right: 142rpx;">
							<view class="mr-30">
								生活
							</view>
							<view class="">
								{{item.createtime | time}}
							</view>
						</view>
						<view class="flex flex-end">
							<view class="">
								阅读 {{item.read_num}}
							</view>
							<view class="">
								赞 {{item.click}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view> 
	</view> 
</template> 
<script>
	export default {
		data() {
			return {
				navbaractive: false,
				leftimg: true,
				zanwushuj: false,
				inputtext: '',
				article: [],
				doctor: [],
				goods: [],
			}
		},
		filters: {
			time(value) {
				let getFullYear = new Date(value).getFullYear();
				let getMonth = new Date(value).getMonth() + 1;
				let getDay = new Date(value).getDay();
				return getMonth + '月' + getDay + '日'
			}
		},

		onLoad() {
			// this.onsh();
		},
		methods: {
			onsh() {
					this.zanwushuj = false;
				this.$https('doctindex.indexsearch', {
					keyword: this.inputtext
				}).then(res => {
				
					// if (this.inputtext != '') {
					// 	this.inputtext = ''
					// }
					this.article = [];
					this.doctor = [];
					this.goods = [];
					var data = res.data;
					this.article = data.article;
					this.doctor = data.doctor;
					this.goods = data.goods;
					console.log(res, 'gfuygu')
					if (data.article.length==0 && data.doctor.length==0 && data.goods.length==0) {
						this.zanwushuj = true
						console.log('味道如何哪位达人华为的')
					}
					// if (res.code === 1) {
					// 	commit('AGENT_INFO', res.data.data);
					// }
					// resolve(res)
				}).catch(e => {
					// reject(e)
				});
			},
			inputsearch() {
				this.onsh()
			},

			doctAll() {
				uni.navigateTo({
					url: `/goodsPage/searchDoct/searchDoct`
				})
			},
			// 医生简介
			doctintro(id) {
				uni.navigateTo({
					url: `/goodsPage/doctIntro/doctIntro?id=${id}`
				})
			},
			clear() {
				this.inputtext = '';
				this.leftimg = true
			}
		}
	}
</script>

<style  >
/* 	@import url("@/common/css/fress.css");
	@import url("@/common/css/mycss.css"); */

	.input {
		width: 448rpx;
		height: 64rpx;
		background: #F5F5F5;
		border-radius: 12rpx;
		/* margin-right: 85rpx; */
		margin-left: -158rpx;

	}

	.input_img {
		width: 30rpx;
		height: 30rpx;
	}


	image {
		width: 100%;
		height: 100%;

	}
</style>
